package com.rich.dmr;

import android.app.Activity;
import android.app.Application;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.LinkedList;
import java.util.List;

public class DmrApplication extends Application {
    private List<Activity> activityList = new LinkedList<Activity>();
    private static DmrApplication instance;

    public DmrApplication() {
    }

    public static DmrApplication getInstance() {
        if (instance == null) {
            instance = new DmrApplication();
        }
        //BufferedReader reader = new BufferedReader(new FileReader(filename), 256);

        return instance;
    }

    public void addActivity(Activity activity) {
        this.activityList.add(activity);
    }

    public void exit() {
        for (Activity activity : this.activityList) {
            activity.finish();
        }
        System.exit(0);
    }
}
